package Work1;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        Person[]people=new Person[]{
                new Person("zhangsan",18,"j"),
        new Person("lisi",19,"o"),
        new Person("wangwu",20,"b")
        };
        for (int i = 0; i < people.length; i++) {
            Person tem;
            for (int j = 0; j < people.length - 1 - i; j++) {
                if(people[j].getAge()<people[j+1].getAge()){
                    tem=people[j];
                    people[j]=people[j+1];
                    people[j+1]=tem;
                }
            }
        }
        System.out.println(Arrays.toString(people));
    }
}